package com.betterwood.dragon.core.config;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 商户号配置
 * @author admin060816
 *
 */
@Data
@Component
@ConfigurationProperties(prefix= "wechat-mch")
public class WechatMchConfig implements InitializingBean {

	/**
	 * 公众号绑定的商户id
	 */
	private String mchId;

	/**
	 * 公众号绑定的商户交易安全密钥
	 */
	private String apiKey;
	/**
	 * 公众号token
	 */
	private String token;

	/**小程序支付回调地址*/
	private String xcxPayNotifyUrl;

	/**微信退款回调地址*/
	private String xcxPayRefundUrl;


	public static String MCH_ID;
	public static String API_KEY;
	public static String TOKEN;
	public static String XCX_PAY_NOTIFY_URL;
	public static String XCX_PAY_REFUND_URL;

	@Override
	public void afterPropertiesSet() throws Exception {
		MCH_ID=mchId;
		API_KEY=apiKey;
		TOKEN=token;

		XCX_PAY_NOTIFY_URL=xcxPayNotifyUrl;
		XCX_PAY_REFUND_URL=xcxPayRefundUrl;
	}
}
